package com.ruoyi.web.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * QGPayRechargeDetailEnum
 *
 * @since 2022/8/15 16:19
 */
public enum SmsSendDetailEnum {
    ;

    /**
     * 状态（request_fail 请求失败、queued 队列中、sending 正在发送到运营商、sent 已发送到运营商、failed 发送失败、delivered 已送达、undelivered 未能送达、receiving 正在处理收到的信息、received 已收到、accepted 请求已接受、scheduled 已安排发送、read 已读、partially_delivered 部分已送达、canceled 已撤销）
     */
    @Getter
    @AllArgsConstructor
    public enum Status {
        /**
         * request_fail 请求失败
         */
        REQUEST_FAIL("请求失败", "request_fail"),
        /**
         * queued 队列中
         */
        QUEUED("队列中", "queued"),
        /**
         * sending 正在发送到运营商
         */
        SENDING("正在发送到运营商", "sending"),
        /**
         * sent 已发送到运营商
         */
        SENT("已发送到运营商", "sent"),
        /**
         * failed 发送失败
         */
        FAILED("发送失败", "failed"),
        /**
         * delivered 已送达
         */
        DELIVERED("已送达", "delivered"),
        /**
         * undelivered 未能送达
         */
        UNDELIVERED("未能送达", "undelivered"),
        /**
         * receiving 正在处理收到的信息
         */
        RECEIVING("正在处理收到的信息", "receiving"),
        /**
         * received 已收到
         */
        RECEIVED("已收到", "received"),
        /**
         * accepted 请求已接受
         */
        ACCEPTED("请求已接受", "accepted"),
        /**
         * scheduled 已安排发送
         */
        SCHEDULED("已安排发送", "scheduled"),
        /**
         * read 已读
         */
        READ("已读", "read"),
        /**
         * partially_delivered 部分已送达
         */
        PARTIALLY_DELIVERED("部分已送达", "partially_delivered"),
        /**
         * canceled 已撤销
         */
        CANCELED("已撤销", "canceled");

        private final String name;
        private final String value;

        /**
         * 根据name查找对应value
         *
         * @param name 枚举名称
         * @return java.lang.String
         * @author gong_da_kai
         * @since 2021/11/14
         */
        public static String findValue(String name) {
            for (Status item : values()) {
                if (item.getName().equals(name)) {
                    return item.getValue();
                }
            }

            return null;
        }

        /**
         * 根据value查找对应的name
         *
         * @param value 枚举值
         * @return java.lang.String
         * @author gong_da_kai
         * @since 2021/11/14
         */
        public static String findName(String value) {
            for (Status item : values()) {
                if (item.getValue().equals(value)) {
                    return item.getName();
                }
            }

            return null;
        }
    }

}
